package com.tanhua.server.controller;

import com.tanhua.server.service.BaiduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/baidu")
public class BaiduController {

    @Autowired
    private BaiduService baiduService;

    @PostMapping("/location")
    public ResponseEntity<Object> getLocation(@RequestBody Map<String,Object> params){
        Double latitude = (Double) params.get("latitude");
        Double longitude = (Double) params.get("longitude");
        String addrStr = (String) params.get("addrStr");
        return baiduService.getLocation(latitude,longitude,addrStr);
    }
}
